<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>代理商注册</title>
	<%@ include file="/pages/common/common.jsp" %>		
	<link rel="stylesheet" type="text/css" href="${ctx}/css/register.css" />
	<script type="text/javascript">
		
	$(function(){
		$("#userPwd1").blur(function(){
			if($(this).val()==$("#password").val()){
			document.getElementById("passwordfail").style.display="none";
			} else {
			document.getElementById("passwordfail").style.display="";

			}
		});
		
		
		
	})
		
		
	/** 注册 */
	function reg(){
		var r = $('#regForm').form('validate');
		if(!r) {
			return false;
		}
		var url="${ctx}/agent/register.action";
		
		$.post(url,$("#regForm").serializeArray(),function(data){
			//$('#regForm').form('clear');
			if(data.success){//操作成功
				$.messager.alert('提示','注册成功，您的代理商编号是<b>'+data.msg+'</b>,请牢记此编号，用户代理商登录','info',function(){
					location.href="${ctx}/pages/login.jsp?userName="+data.msg;	
				});
			}else{
				$.messager.alert('提示',data.msg,'warning');	
			}
		});
	}	
	function clearReg(){
		$('#regForm').form('clear');
	}
	</script>	
  </head>
  <body style="margin:0;padding:0;height:100%;overflow:scroll;background:#fff">
  <form class="auform" id="regForm" method="post">
  <div id="register_div">
  	<h2>代理商注册</h2>
	<div class="demo-info">
		<div class="demo-tip icon-tip"></div>
		<div>请仔细填写公司信息和个人信息，保证公司信息和个人真实有效。</div>
	</div>
	<div class="info_div">
		<div class="info_title">代理商信息</div>
		<div class="info_content">
			<table>
				
				<tr>
				<td class="autd1">代理商名称：</td>
				<td class="autd2"><input name="agent.name" class="easyui-validatebox txt" validType="length[2,50]" style="width:150px;" required="true"><span class="red">*</span></td>
				<td class="autd1">联系人：</td>
				<td class="autd2"><input name="agent.linkman" id="compDept"  class="easyui-validatebox txt"  validType="length[0,100]" style="width:150px;"><span class="red">*</span></td>				
				</tr>
				<tr>
				<td class="autd1">联系电话：</td>
				<td class="autd2"><input name="agent.tel" id="compFc" class="easyui-validatebox txt" validType="mobile" class="txt" style="width:150px;" required="true"/><span class="red">*</span></td>
				<td class="autd1">代理地区：</td>
				<td class="autd2"><input name="agent.area" id="compTel"  class="easyui-validatebox txt"  validType="length[0,20]" style="width:150px;" required="true"><span class="red">*</span></td>				
				</tr>
				<tr>
				<td class="autd1">区域负责人：</td>
				<td class="autd2"><input name="agent.channelMgr" id="street" class="easyui-validatebox txt" validType="length[0,100]" class="txt" style="width:150px;" required="true"/><span class="red">*</span></td>
				<td class="autd1">密码：</td>
				<td class="autd2"><input name="agent.password" id="password" type="password" style="width:150px" validType="length[6,30]" class="easyui-validatebox txt" required="true"><span class="red">*</span></td>
				</tr>
				<tr>
				<td class="autd1">确认密码：</td>
				<td class="autd2"><input name="userPwd1" id="userPwd1" type="password" style="width:150px" validType="length[6,30]" class="easyui-validatebox txt" required="true"><span class="red">*</span>
				<span style=display:none id="passwordfail"><font color="red">两次输入密码不一致</font></span>
				</td>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				</tr>
				
			</table>
		</div>
	</div>
	
	
	<div class="btn_div">
		<a id="btn-add" onclick="clearReg();" class="easyui-linkbutton" iconCls="icon-cancel">重填</a>&nbsp;
		<a id="btn-add" onclick="reg();" class="easyui-linkbutton" iconCls="icon-save">注册</a>
	</div>
</div>
</form>
</body>

</html>
